package com.hxd.otc.module.wallet.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hxd.otc.R;
import com.hxd.otc.module.wallet.bean.WalletAccountInfoBean;
import com.hxd.otc.utils.StringUtil;
import com.hxd.otc.utils.UIUtils;

import java.util.List;

/**
 * 作  者 :  卫广玉
 * 时  间 :  2018/6/6 11:36
 * 描  述 :  ${钱包币种列表Adapter}
 */
public class CoinDetailsAdapter extends BaseQuickAdapter<WalletAccountInfoBean.HoldCoinDetailVo, BaseViewHolder> {

    public CoinDetailsAdapter(@Nullable List<WalletAccountInfoBean.HoldCoinDetailVo> data) {
        super(R.layout.list_item_wallet_coin_details, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, WalletAccountInfoBean.HoldCoinDetailVo item) {
        helper.setImageResource(R.id.iv_coin_logo, item.getIconLogoResId());
        helper.setText(R.id.tv_coin_name, item.getCoinType());
        helper.setText(R.id.tv_total, StringUtil.format8Number(item.totalAmount));
        helper.setText(R.id.tv_cny_total, UIUtils.getContext().getString(R.string.wallet_assets_to_cny,
                StringUtil.format8Number(item.totalLegalTenderAmount), item.legalTenderUnit));
    }
}